﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace IKE
{
    //Struktura Termu kterou mám uloženou ve WEE
    //#region DOC

    //public class Term
    //{
    //    public Int32 ID { get; set; } //ID of Term
    //    public Int32 RootID { get; set; } //ID of RootTerm

    //    public string Name { get; set; } //Name of Term
    //    public string URL { get; set; }  //URL to Wiki-page
    //    public string Text { get; set; } //Texts about Term

    //    public Bubble Bubble { get; set; } //Settings of displayed Bubble
    //    public Line Line { get; set; } //Settings of displayed Line to Root Term
    //}

    //public class Bubble
    //{
    //    public Color Color { get; set; }
    //    public Location Location { get; set; }
    //    public Double Size { get; set; }
    //}

    //public class Line
    //{
    //    public Color Color { get; set; }
    //    public Double Size { get; set; }
    //}

     


        //public void AddTermListToGraph(List<Term> termList)
        //{
        //    foreach (Term term in termList)
        //    {
        //        AddTermToGraph(term);
        //    }
        //    //PaintTerm(termList[0]); //this
        //    //this    RepaintGraph();
        //}


        //public void AddTermToGraph(Term term)
        //{
        //    bool exist = false;
        //    foreach (Term tt in terms)
        //        if (term.ID == tt.ID)
        //            exist = true;
        //    if (!exist)
        //    {
        //        terms.Add(term);
        //        // PaintTerm(term);
        //        //this  RepaintGraph(); 
        //    }
        //}


        //public void RemoveTermFromGraph(Term term)
        //{
        //    if (terms.Contains(term))
        //    {
        //        terms.Remove(term);
        //        RepaintGraph();
        //    }
        //}


        //public Int32 deepTerm(Int32 ID, Int32 num)
        //{
        //    Int32 ret = num;
        //    foreach (Term tt in terms)
        //        if (tt.ID == ID)
        //        {
        //            if (tt.RootID != tt.ID)
        //            {
        //                num++;
        //                ret = deepTerm(tt.RootID, num);
        //            }
        //        }
        //    return ret;
        //}


        //public Term getTerm(Int32 ID)
        //{
        //    foreach (Term tt in terms)
        //        if (tt.ID == ID)
        //            return tt;
        //    return new Term();
        //}

      //public Term getRootTerm()
      //  {
      //      foreach (Term tt in terms)
      //          if (tt.ID == tt.RootID)
      //              return tt;
      //      return new Term();
      //  }


        ///// <summary>
        ///// Gets some points for the Polygon
        ///// </summary>
        //private LocationCollection GetPoints(int count, double centerX, double centerY, Int32 deep)
        //{
        //    double width = 10 / (1 + deep);// myMap.ViewportSize.Width * 0.1;

        //    LocationCollection points = new LocationCollection();

        //    for (int i = 0; i < count; i++)
        //    {
        //        double j = (double)i / (double)count;
        //        Point point = new Point(centerX + Math.Cos(j * 2 * Math.PI) * width,
        //                      centerY + Math.Sin(j * 2 * Math.PI) * width);
        //        points.Add(new Location(point.X, point.Y)); //myMap.ViewportPointToLocation(point)
        //    }

        //    return points;
        //}


        //public void RepaintGraph()
        //{
        //    mlTerm.Children.Clear();
        //    mlLine.Children.Clear();

        //    foreach (Term term in terms)
        //    {
        //        PaintTermChild(term);
        //    }
        //    PaintTerm(terms[0]);
        //}


        //public void PaintTermChild(Term term)
        //{
        //    if (term.Bubble.Color == null)
        //        term.Bubble.Color = Colors.Orange;

        //    Int32 deep = deepTerm(term.RootID, 0);

        //    Int32 countChild = 0;
        //    foreach (Term rootTerm in terms)
        //        if (rootTerm.RootID == term.ID)
        //            countChild++;

        //    LocationCollection loc = GetPoints(countChild, term.Bubble.Location.Latitude, term.Bubble.Location.Longitude, deep);
        //    Int32 i = 0;

        //    foreach (Term childTerm in terms)
        //    {
        //        if (childTerm.RootID == term.ID)
        //        {
        //            //if (childTerm.Bubble.Location != new Location(0, 0))
        //            childTerm.Bubble.Location = loc[i];
        //            mlLine.AddChild(AddLineToLayer(term.Bubble.Location, childTerm.Bubble.Location, childTerm.Line.Color, childTerm.Line.Size));
        //            mlTerm.AddChild(AddEllipseToLayer(childTerm.Bubble.Location, childTerm.Bubble.Color, childTerm.Name, Convert.ToInt32(childTerm.Bubble.Size), childTerm.ID)); //this
        //            i++;
        //        }
        //    }
        //}


        //public void PaintTerm(Term term)
        //{
        //    mlTerm.AddChild(AddEllipseToLayer(term.Bubble.Location, term.Bubble.Color, term.Name, Convert.ToInt32(term.Bubble.Size), term.ID));
        //}

    //#endregion DOC

    public class ResultWord : IComparable<ResultWord>
    {
        public String wordID { get; set; }
        public String weight { get; set; }
        public String pageID { get; set; }
        public String pageName { get; set; }

        public int CompareTo(ResultWord obj)
        {
            return (Convert.ToInt32(weight)).CompareTo(Convert.ToInt32(obj.weight));
        }
    }
}
